var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, a) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var a in e)
              Object.prototype.hasOwnProperty.call(e, a) && (t[a] = e[a]);
          })(e, a);
      };
      return function (e, a) {
        function r() {
          this.constructor = e;
        }
        if ("function" != typeof a && null !== a)
          throw new TypeError(
            "Class extends value " + String(a) + " is not a constructor or null"
          );
        t(e, a),
          (e.prototype =
            null === a
              ? Object.create(a)
              : ((r.prototype = a.prototype), new r()));
      };
    })(),
  AXSelStarListDialog = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        WebSocketService.addListener({
          caller: e,
          code: 1127,
          method: e.onLoadStarListData,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 1128,
          method: e.onLoadStarListData,
        }),
        (e.list_select_star.vScrollBarSkin = ""),
        (e.list_select_star.selectEnable = !0),
        e.list_select_star.on(Laya.Event.CLICK, e, e.onSelectStarDidClick),
        (e.list_select_star.renderHandler = new Handler(e, e.updateItem)),
        e
      );
    }
    return (
      __extends(e, t),
      (e.showSelStarDialog = function (t, a, r) {
        return (
          null == this.selStarDia &&
            ((this.selStarDia = new e()), (this.selStarDia.zOrder = 1e3)),
          this.selStarDia.popup(),
          (this.selStarDia.jsonObj = t),
          "主副将" == t.title
            ? ((this.selStarDia.label_selStar_title.text = "主副将"),
              WebSocketService.send({ c: 1127 }))
            : "从副将" == t.title &&
              ((this.selStarDia.label_selStar_title.text = "从副将"),
              WebSocketService.send({ c: 1128, d: { cid: t.id } })),
          (this.selStarDia.caller = a),
          (this.selStarDia.method = r),
          this.selStarDia
        );
      }),
      (e.prototype.onLoadStarListData = function (t) {
        if (0 == t.code) {
          var e = t.list,
            a = void 0;
          this.dataSource = [];
          for (var r = 0; r < e.length; r++) {
            var l = e[r];
            (a = {
              starName: {
                text:
                  Utils.dealTransAndLvl(l.roleType, l.lvl) +
                  l.name +
                  "(" +
                  l.star +
                  "星)",
              },
              label_vip_button: { label: "选择" },
              id: l.id,
              lvl: l.lvl,
              name: l.name,
              roleType: l.roleType,
              star: l.star,
              s: l.s,
            }),
              this.dataSource.push(a);
          }
          this.list_select_star.dataSource = this.dataSource;
        }
      }),
      (e.prototype.updateItem = function (t, e) {
        var a = t.getChildByName("starBtn"),
          r = t.dataSource;
        void 0 != this.jsonObj.star && this.jsonObj.star != r.star
          ? ((a.disabled = !0), (a.label = "星级不同"), (a.gray = !0))
          : ((a.disabled = !1), (a.label = "选择"), (a.gray = !1));
      }),
      (e.prototype.onSelectStarDidClick = function (t) {
        if ("" != t.target.name && "starBtn" == t.target.name) {
          var e = this.list_select_star.selectedItem;
          this.method.call(this.caller, e), this.close();
        }
      }),
      e
    );
  })(ui.SquareController.AXSelStarListDialogUI);
